package com.px.controller;

import com.px.dto.ReturnResult;
import com.px.service.OrderService;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
@RequestMapping("/api/v/order")
public class OrderController {

    @Resource
    private OrderService orderService;

    //根据登陆的用户Id查询该用户的所有信息
    @GetMapping("/lookuserorderlist")
    public ReturnResult findOrderByUserId(String token, Model model) throws Exception{
        return orderService.selectOrderByUserId(token,model);
    }

    //根据订单ID获取订单详细信息
    @GetMapping("/lookorder")
    public ReturnResult findOrderByOrderId(Integer orderId,String token) throws Exception{
        return orderService.selectOrderByOrderId(orderId,token);
    }

}
